
package com.insigma.business.qrcode.common.converter;

import com.insigma.business.qrcode.pay.dto.CareWelfareMerchantEvaluationDTO;
import com.insigma.business.qrcode.pay.dto.CareWelfareMerchantEvaluationSearchRequest;
import com.insigma.business.qrcode.merchant.dto.search.CareWelfareMerchantEvaluationBSearcher;
import com.insigma.business.qrcode.merchant.entity.CareWelfareMerchantEvaluationDO;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantEvaluationInsertRequest;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantEvaluationUpdateRequest;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class CareWelfareMerchantEvaluationProviderConverter extends AbstractConverter<CareWelfareMerchantEvaluationDTO, CareWelfareMerchantEvaluationDO> {

    private final static CareWelfareMerchantEvaluationProviderConverter careWelfareMerchantEvaluationConverter = new CareWelfareMerchantEvaluationProviderConverter();

    private CareWelfareMerchantEvaluationProviderConverter(){}

    
    public static CareWelfareMerchantEvaluationBSearcher convertRequestSO2Searcher(final CareWelfareMerchantEvaluationSearchRequest request){
        final CareWelfareMerchantEvaluationBSearcher careWelfareMerchantEvaluationBSearcher = new CareWelfareMerchantEvaluationBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,careWelfareMerchantEvaluationBSearcher);
        return careWelfareMerchantEvaluationBSearcher;
    }

    
    public static CareWelfareMerchantEvaluationDO convertRequestUO2DO(final CareWelfareMerchantEvaluationUpdateRequest careWelfareMerchantEvaluationUpdateRequest) {
        final CareWelfareMerchantEvaluationDO careWelfareMerchantEvaluationDO = new CareWelfareMerchantEvaluationDO();
        BeanUtils.copyProperties(careWelfareMerchantEvaluationUpdateRequest,careWelfareMerchantEvaluationDO);
        
        return careWelfareMerchantEvaluationDO;
    }

    
    public static CareWelfareMerchantEvaluationDO convertRequestIO2DO(final CareWelfareMerchantEvaluationInsertRequest careWelfareMerchantEvaluationInsertRequest) {
        final CareWelfareMerchantEvaluationDO careWelfareMerchantEvaluationDO = new CareWelfareMerchantEvaluationDO();
        BeanUtils.copyProperties(careWelfareMerchantEvaluationInsertRequest,careWelfareMerchantEvaluationDO);
        return careWelfareMerchantEvaluationDO;
    }

    
    public static List<CareWelfareMerchantEvaluationDTO> convertResponseDOList2DTOList(final List<CareWelfareMerchantEvaluationDO> careWelfareMerchantEvaluationDOList){
        return careWelfareMerchantEvaluationConverter.convertGenericResponseDOList2DTOList(careWelfareMerchantEvaluationDOList);
    }

    
    public static CareWelfareMerchantEvaluationDTO convertResponseDO2DTO(final CareWelfareMerchantEvaluationDO careWelfareMerchantEvaluationDO){
        return careWelfareMerchantEvaluationConverter.convertGenericResponseDO2DTO(careWelfareMerchantEvaluationDO);
    }

    
    @Override
    protected CareWelfareMerchantEvaluationDTO doConvertResponseDO2DTO(CareWelfareMerchantEvaluationDO careWelfareMerchantEvaluationDO) {
        final CareWelfareMerchantEvaluationDTO careWelfareMerchantEvaluationDTO = new CareWelfareMerchantEvaluationDTO();
        try {
            BeanUtils.copyProperties(careWelfareMerchantEvaluationDO, careWelfareMerchantEvaluationDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return careWelfareMerchantEvaluationDTO;
    }

}
